home *** CD-ROM | disk | FTP | other *** search
/ Aminet 37 / Aminet 37 (2000)(Schatztruhe)[!][Jun 2000].iso / Aminet / dev / lang / sofa.lha / sofa / smalleiffel / lib_se / e_check.e < prev    next >
Text File  |  2000-03-25  |  4KB  |  130 lines

  1. --          This file is part of SmallEiffel The GNU Eiffel Compiler.
  2. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  3. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr
  4. --                       http://SmallEiffel.loria.fr
  5. -- SmallEiffel is  free  software;  you can  redistribute it and/or modify it
  6. -- under the terms of the GNU General Public License as published by the Free
  7. -- Software  Foundation;  either  version  2, or (at your option)  any  later
  8. -- version. SmallEiffel is distributed in the hope that it will be useful,but
  9. -- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. -- or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU General Public License
  11. -- for  more  details.  You  should  have  received a copy of the GNU General
  12. -- Public  License  along  with  SmallEiffel;  see the file COPYING.  If not,
  13. -- write to the  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. -- Boston, MA 02111-1307, USA.
  15. --
  16. class E_CHECK
  17.    --
  18.    -- Instruction "check ... end;".
  19.    --
  20.  
  21. inherit INSTRUCTION;
  22.  
  23. creation make
  24.  
  25. feature
  26.  
  27.    end_mark_comment: BOOLEAN is true;
  28.  
  29.    start_position: POSITION is
  30.          -- Of keyword "check".
  31.       do
  32.          if check_invariant /= Void then
  33.             Result := check_invariant.start_position;
  34.          end;
  35.       end;
  36.  
  37.    to_runnable(ct: TYPE): like Current is
  38.       do
  39.          if run_control.all_check then
  40.             if current_type = Void then
  41.                current_type := ct;
  42.                if check_invariant /= Void then
  43.                   check_invariant := check_invariant.to_runnable(ct);
  44.                end;
  45.                Result := Current;
  46.             else
  47.                !!Result.make(start_position,Void,check_invariant.list);
  48.                Result := Result.to_runnable(ct);
  49.             end;
  50.          else
  51.             current_type := ct;
  52.             Result := Current;
  53.          end;
  54.       end;
  55.  
  56.    stupid_switch(r: ARRAY[RUN_CLASS]): BOOLEAN is
  57.       do
  58.          Result := true;
  59.       end;
  60.  
  61.    afd_check is
  62.       do
  63.          if run_control.all_check and then check_invariant /= Void then
  64.             check_invariant.afd_check;
  65.          end;
  66.       end;
  67.  
  68.    collect_c_tmp is
  69.       do
  70.       end;
  71.  
  72.    compile_to_c is
  73.       do
  74.          if run_control.all_check and then check_invariant /= Void then
  75.             check_invariant.compile_to_c;
  76.          end;
  77.       end;
  78.  
  79.    compile_to_jvm is
  80.       do
  81.          if run_control.all_check and then check_invariant /= Void then
  82.             check_invariant.compile_to_jvm(true);
  83.             code_attribute.opcode_pop;
  84.          end;
  85.       end;
  86.  
  87.    is_pre_computable: BOOLEAN is
  88.       do
  89.          if run_control.all_check and then check_invariant /= Void then
  90.             Result := check_invariant.is_pre_computable;
  91.          else
  92.             Result := true;
  93.          end;
  94.       end;
  95.  
  96.    use_current: BOOLEAN is
  97.       do
  98.          if run_control.all_check and then check_invariant /= Void then
  99.             Result := check_invariant.use_current;
  100.          end;
  101.       end;
  102.  
  103.    pretty_print is
  104.       do
  105.          if check_invariant /= Void then
  106.             check_invariant.pretty_print;
  107.             fmt.put_string("end;");
  108.             if fmt.print_end_check then
  109.                fmt.put_end("check");
  110.             end;
  111.          end;
  112.       end;
  113.  
  114. feature {NONE}
  115.  
  116.    check_invariant: CHECK_INVARIANT;
  117.  
  118.    current_type: TYPE;
  119.  
  120.    make(sp: like start_position; hc: COMMENT; l: ARRAY[ASSERTION]) is
  121.       require
  122.          not sp.is_unknown
  123.       do
  124.          if hc /= Void or else l /= Void then
  125.             !!check_invariant.make(sp,hc,l);
  126.          end;
  127.       end;
  128.  
  129. end -- E_CHECK
  130.